]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
iconGrid: Remove unreachable code
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 29 Jan 2019 22:00:46 +0000 (23:00 +0100)
committerFlorian Müllner <florian.muellner@gmail.com>
Wed, 30 Jan 2019 16:13:17 +0000 (16:13 +0000)
Throwing an exception already aborts a function, so there's no need
for a return statement in that case.

Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/375

js/ui/iconGrid.js

index cd54d50a34a350b452423f315f3a9fcb3e959826..452dc0c96cabd88834e106cf8354e9cc256965ec 100644 (file)
@@ -906,10 +906,8 @@ var PaginatedIconGrid = GObject.registerClass({
     getItemPage(item) {
         let children = this._getVisibleChildren();
         let index = children.indexOf(item);
-        if (index == -1) {
+        if (index == -1)
             throw new Error('Item not found.');
-            return 0;
-        }
         return Math.floor(index / this._childrenPerPage);
     }
 
@@ -924,10 +922,9 @@ var PaginatedIconGrid = GObject.registerClass({
     openExtraSpace(sourceItem, side, nRows) {
         let children = this._getVisibleChildren();
         let index = children.indexOf(sourceItem.actor);
-        if (index == -1) {
+        if (index == -1)
             throw new Error('Item not found.');
-            return;
-        }
+
         let pageIndex = Math.floor(index / this._childrenPerPage);
         let pageOffset = pageIndex * this._childrenPerPage;